package com.example.love.controller.User;

import cn.hutool.crypto.SecureUtil;
import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Slf4j
public class testMd5_And_BCryptPasswordEncoder {
  /* public static void main(String[] args) {
        String pass1="123457";
        String str = SecureUtil.md5(pass1);
        log.info(str);
        String pass2 ="123457";
        String str2 = SecureUtil.md5(pass2);
        log.info(str2);
        System.out.println("看看两次的密码是否一样？"+str.equals(str2));
    }*/

    public static void main(String[] args) {
        String password = "123456";
       // BCryptPasswordEncoder bcryptPasswordEncoder = new BCryptPasswordEncoder();


        ;
        //加密：bcryptPasswordEncoder进行密码加密
      //  String encodedPassword = bcryptPasswordEncoder.encode(SecureUtil.md5(password)+password+SecureUtil.md5(password));
       // System.out.println("bcryptPasswordEncoder进行密码加密:"+encodedPassword);

        //解密：
     //   boolean flag = bcryptPasswordEncoder.matches(SecureUtil.md5(password)+password+SecureUtil.md5(password), encodedPassword);
        //如果flag为true，则解密成功  false，则解密失败
        //System.out.println("解密："+flag);

    }
}
